package org.jluzhCS.mylogin.action;

import org.jluzhCS.mylogin.domain.User;
import java.util.List;
import org.jluzhCS.mylogin.service.UserService;

import com.opensymphony.xwork2.Action;


public class loginAction implements Action {

	private User user;
	private List<User> allUser;
	
	public User getUser() {
		return user;
	}


	public void setUser(User user) {
		this.user = user;
	}

	@Override
	public String execute() throws Exception {
		UserService us = new UserService();
		Integer id = us.ValidLogin(user);
        if(id>0)
        {return SUCCESS;}
        return ERROR;
	}
	
	public String showUsers() throws Exception{
		UserService us = new UserService();
		setAllUser(us.getAllUser());
		return SUCCESS;
	}


	public List<User> getAllUser() {
		return allUser;
	}


	public void setAllUser(List<User> allUser) {
		this.allUser = allUser;
	}


	


	

}
